import React from "react";
class RefClassComponent extends React.Component {
  constructor(props) {
    super(props);
    this.el = React.createRef();
  }

  state = {
    name : 'I\'m a child'
  }

  changeName = (name) => {
    this.setState({name})
  };
  render() {
    return (
      <div>
        {this.state.name}
        <button onClick={ () => {this.changeName('zhangsan')}}>ChangeName</button>
      </div>
    );
  }
}
export default RefClassComponent;
